import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';

import { feedMetaDefaultProps } from './defaultProps';
import type { FeedMetaOptions } from './type';

export interface FeedMetaProps extends FeedMetaOptions, HTMLAttributes<HTMLDivElement> {}

const FeedMeta: FC<FeedMetaProps> = (props) => {
  const { className, children, forwardedRef, ...feedMetaProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames('meta', className), ...feedMetaProps },
    children,
  );
};

FeedMeta.displayName = 'FeedMeta';
FeedMeta.defaultProps = feedMetaDefaultProps;

export default FeedMeta;
